﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HRWebSite.User
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txt1.Text) && !string.IsNullOrEmpty(this.txt2.Text))
            {
                Forget.HRBLL.Model.User user = Forget.HRBLL.Logical.UserLogical.Login(this.txt1.Text, this.txt2.Text);
                string reUrl = this.Request.QueryString["url"];
                if (user != null)
                {
                    Session["CurUser"] = user;
                    if (!string.IsNullOrEmpty(reUrl))
                        this.Response.Redirect(Server.UrlDecode(reUrl));
                    else
                        this.Response.Redirect(@"~\default.aspx");
                }
                else
                {
                    this.literal1.Visible = true;
                    this.literal1.Text = "<span style=\"color: #FF0000\">请检查用户名或密码是否正确</span>";
                }
            }
            else
            {
                this.literal1.Visible = true;
                this.literal1.Text = "<span style=\"color: #FF0000\">用户名或密码不能为空</span>";
            }
        }
    }
}